package com.hytc.mymall.activity;

import android.os.Bundle;
import android.view.KeyEvent;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.hytc.mymall.R;
import com.hytc.mymall.application.ActivityManager;
import com.hytc.mymall.base.BaseActivity;
import com.hytc.mymall.bean.LoginBean;
import com.hytc.mymall.utils.MD5Utils;

public class OnePointMallActivity extends BaseActivity
{
    private WebView wv;

    @Override
    protected void onCreate(final Bundle bundle) {
        super.onCreate(bundle);
        this.setContentView(R.layout.activity_onepointmall);
        this.wv = this.$(2131099956);
        final LoginBean.Data_Login loginBean = ActivityManager.loginBean;
        final String stringExtra = this.getIntent().getStringExtra("type");
        final String stringExtra2 = this.getIntent().getStringExtra("host");
        String string = null;
        Label_0251: {
            if (!stringExtra.equals("ydsc")) {
                final boolean equals = stringExtra.equals("ydlm");
                string = null;
                if (!equals) {
                    break Label_0251;
                }
            }
            if (loginBean != null) {
                final String usernumber = loginBean.usernumber;
                string = String.valueOf(stringExtra2) + "memberid=" + usernumber + "&membername=" + loginBean.username + "&name=" + loginBean.realname + "&email=" + "" + "&headportrait=" + loginBean.picture + "&tel=" + loginBean.mobilenumber + "&nick=" + loginBean.username + "&sex=" + "" + "&sign=" + MD5Utils.MD5(String.valueOf(usernumber) + "+49mkJl0u") + "&isLogin=1";
            }
            else {
                string = stringExtra2;
            }
        }
        final WebSettings settings = this.wv.getSettings();
        settings.setUseWideViewPort(true);
        settings.setJavaScriptEnabled(true);
        this.wv.loadUrl(string);
        this.wv.setWebViewClient((WebViewClient)new MyWebViewClient());
    }

    public boolean onKeyDown(final int n, final KeyEvent keyEvent) {
        if (keyEvent.getKeyCode() == 4 && this.wv.canGoBack()) {
            this.wv.goBack();
            return true;
        }
        this.finish();
        return super.onKeyDown(n, keyEvent);
    }

    private class MyWebViewClient extends WebViewClient
    {
        public boolean shouldOverrideUrlLoading(final WebView webView, final String s) {
            System.out.println(s);
            return super.shouldOverrideUrlLoading(webView, s);
        }
    }
}

